<?php

namespace app\member\controller;

/** 控制器类引入区 **/
use app\common\controller\Smscm;

/** 模型类引入区 **/
use app\common\model\Goods as GoodsM;
use app\common\model\GoodsCategory as GoodsCategoryM;

/** 核心或第三方类引入区 **/


/**
 * 商品控制器
 * @package app\api\controller
 */
class Product extends Base
{
    public $noNeedLogin = ['*'];


    /**
     *  商品分类
    **/
    public function getCateList()
    {
        $store_id         = $this->store_id;
        $ProductCategoryM = new GoodsCategoryM();
        $list             = $ProductCategoryM->getList($store_id);
        $this->result('获取成功',$list,200);
    }


    /**
     *  商品列表
    **/
    public function getProductList()
    {
        $store_id         = $this->store_id;
        $cate_id          = $this->request->post('cate_id');
        $keyword          = $this->request->post('keyword','');
        $limit            = $this->request->post('limit',10);

        $ProductM         = new GoodsM();
        $list             = $ProductM->productList($store_id,$cate_id,$keyword,$limit);
        $this->result('获取成功',$list,200);
    }

    /**
     *  商品详情
    **/
    public function getProductInfo()
    {
        $store_id         = $this->store_id;
        $id               = $this->request->post('id');
        $ProductM         = new GoodsM();
        $list             = $ProductM->productInfo($store_id,$id);
        $this->result('获取成功',$list,200);

    }

}
